home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / ksslinfodlg.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-10-10  |  5.1 KB  |  174 lines

  1. /* This file is part of the KDE project
  2.  *
  3.  * Copyright (C) 2000-2003 George Staikos <staikos@kde.org>
  4.  * Copyright (C) 2000 Malte Starostik <malte@kde.org>
  5.  *
  6.  * This library is free software; you can redistribute it and/or
  7.  * modify it under the terms of the GNU Library General Public
  8.  * License as published by the Free Software Foundation; either
  9.  * version 2 of the License, or (at your option) any later version.
  10.  *
  11.  * This library is distributed in the hope that it will be useful,
  12.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14.  * Library General Public License for more details.
  15.  *
  16.  * You should have received a copy of the GNU Library General Public License
  17.  * along with this library; see the file COPYING.LIB.  If not, write to
  18.  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  19.  * Boston, MA 02110-1301, USA.
  20.  */
  21.  
  22. #ifndef _KSSLINFODLG_H
  23. #define _KSSLINFODLG_H
  24.  
  25. #include <kdialog.h>
  26.  
  27. #include "ksslx509map.h"
  28. #include "ksslcertificate.h"
  29. #include "kssl.h"
  30. #include <qscrollview.h>
  31.  
  32. class QWidget;
  33. class KSSLCertBox;
  34. class KSSLCertChain;
  35.  
  36.  
  37. /**
  38.  * KDE SSL Information Dialog
  39.  *
  40.  * This class creates a dialog that can be used to display information about
  41.  * an SSL session.
  42.  *
  43.  * There are NO GUARANTEES that KSSLInfoDlg will remain binary compatible/
  44.  * Contact staikos@kde.org for details if needed.
  45.  *
  46.  * @author George Staikos <staikos@kde.org>
  47.  * @see KSSL
  48.  * @short KDE SSL Information Dialog
  49.  */
  50. class KIO_EXPORT KSSLInfoDlg : public KDialog {
  51.     Q_OBJECT
  52. public:
  53.     /**
  54.      *  Construct a KSSL Information Dialog
  55.      *
  56.      *  @param secureConnection true if the connection is secured with SSL
  57.      *  @param parent the parent widget
  58.      *  @param name the internal name of this instance
  59.      *  @param modal true if the dialog should be modal
  60.      */
  61.     KSSLInfoDlg(bool secureConnection, QWidget *parent=0L, const char *name=0L, bool modal=false);
  62.  
  63.     /**
  64.      *  Destroy this dialog
  65.      */
  66.     virtual ~KSSLInfoDlg();
  67.  
  68.     /**
  69.      *  Tell the dialog if the connection has portions that may not be
  70.      *  secure (ie. a mixture of secure and insecure frames)
  71.      *
  72.      *  @param isIt true if security is in question
  73.      */
  74.     void setSecurityInQuestion(bool isIt);
  75.  
  76.     /**
  77.      *  Setup the dialog before showing it.
  78.      *
  79.      *  @param cert the certificate presented by the site
  80.      *  @param ip the ip of the remote host
  81.      *  @param url the url being accessed
  82.      *  @param cipher the cipher in use
  83.      *  @param cipherdesc text description of the cipher in use
  84.      *  @param sslversion the version of SSL in use (SSLv2, SSLv3, TLSv1, etc)
  85.      *  @param usedbits the number of bits in the cipher key being used
  86.      *  @param bits the bit-size of the cipher in use
  87.      *  @param certState the certificate state (valid, invalid, etc)
  88.      */
  89.     void setup(KSSLCertificate *cert,
  90.             const QString& ip, const QString& url,
  91.             const QString& cipher, const QString& cipherdesc,
  92.             const QString& sslversion, int usedbits, int bits,
  93.             KSSLCertificate::KSSLValidation certState);
  94.  
  95.     /**
  96.      *  Setup the dialog before showing it.  This is a convenience version
  97.      *  of the above method, and obtains the same information using the
  98.      *  @param ssl parameter instead.
  99.      *
  100.      *  @param ssl the ssl connection
  101.      *  @param ip the ip of the remote host
  102.      *  @param url the url being accessed
  103.      */
  104.     void setup( KSSL & ssl, const QString & ip, const QString & url );
  105.  
  106.         /**
  107.          *  Set the errors that were encountered while validating the site 
  108.          *  certificate.
  109.          */
  110.         void setCertState(const QString &errorNrs);
  111.  
  112.     /**
  113.      *  Utility function to generate the widget which displays the detailed
  114.      *  information about an X.509 certificate.
  115.      *
  116.      *  @param parent the parent widget
  117.      *  @param certName the name (subject) of the certificate
  118.      *  @param mailCatcher the class which catches click events on e-mail
  119.      *         addresses
  120.      */
  121.     static KSSLCertBox *certInfoWidget(QWidget *parent, const QString &certName, QWidget *mailCatcher=0);
  122.  
  123. private:
  124.     QScrollView *buildCertInfo(const QString &certName);
  125.     void displayCert(KSSLCertificate *x);
  126.  
  127.     class KSSLInfoDlgPrivate;
  128.     KSSLInfoDlgPrivate *d;
  129.  
  130. private slots:
  131.     void launchConfig();
  132.     void urlClicked(const QString &url);
  133.     void mailClicked(const QString &url);
  134.     void slotChain(int x);
  135. };
  136.  
  137.  
  138. /**
  139.  * KDE SSL Certificate Box
  140.  *
  141.  * This class creates a widget which formats and displays the contents of an
  142.  * SSL X.509 certificate.  That is, it takes the "subject" of the certificate
  143.  * and displays everything contained therein.
  144.  *
  145.  * @author George Staikos <staikos@kde.org>
  146.  * @see KSSLInfoDlg
  147.  * @short KDE SSL Certificate Box
  148.  */
  149. class KIO_EXPORT KSSLCertBox : public QScrollView {
  150. public:
  151.     /**
  152.      *  Construct a certificate box
  153.      *
  154.      *  @param parent the parent widget
  155.      *  @param name the internal name of this instance
  156.      *  @param f widget flags for the object
  157.      */
  158.     KSSLCertBox(QWidget *parent=0L, const char *name=0L, WFlags f=0);
  159.  
  160.     /**
  161.      *  Change the contents of the widget
  162.      *
  163.      *  @param certName the name ("subject") of the certificate
  164.      *  @param mailCatcher the widget which catches the url open events
  165.      */
  166.     void setValues(QString certName, QWidget *mailCatcher=0L);
  167.  
  168. private:
  169.     QFrame *_frame;
  170. };
  171.  
  172. #endif
  173.  
  174.